package com.th.dao;

import com.th.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author ThreePure
 * @date 20/12/16 20:11
 * @description:user表的Dao层接口
 * @since 1.8
 */
public interface UserMapper {
    /**
     * @description: 查询所有的用户
     * @date 20/12/17 11:13
     * @Param: []
     * @Return: java.util.List<com.th.pojo.User>
     */
    @Select("select * from user")
    List<User> getUserList();

    /**当有多个参数时,所有的参数前必须加上@Param("id") 注解*/
    @Select("select * from user where id=#{id}")
    User getUserById(@Param("id") int ids);


    @Insert("insert into user(id,name,pwd) values(#{id},#{name},#{pwd})")
    int addUser(User user);

    @Update("update user set name=#{name},pwd=#{pwd} where id = #{id}")
    int updateUser(User user);

    @Delete("delete from user where id=#{id}")
    int deleteUser(@Param("id") int uid);


}
